package com.fakeofarty;

import java.util.ArrayList;

public class Point {

	public Point(long time, float distance, float speed) {
		mTime = time;
		mDistance = distance;
		mSpeed = speed;
	}

	public long mTime = 0;
	public float mDistance = 0;
	public float mSpeed = 0;

	public float getDistanceTo(ArrayList<Point> pointArray, float backPoint) {
		if (pointArray == null || pointArray.size() == 0)
			return backPoint * 2 - mDistance;
		return backPoint * 2 - mDistance
				- pointArray.get(pointArray.size() - 1).mDistance;
	}

	public static float getLastDistance(ArrayList<Point> pointArray) {
		if (pointArray == null || pointArray.size() == 0)
			return 0;
		if (pointArray.size() == 1)
			return pointArray.get(0).mDistance;
		return pointArray.get(pointArray.size() - 1).mDistance
				- pointArray.get(pointArray.size() - 2).mDistance;
	}
}
